package network.server;

import network.Authentication;
import network.Configuration;
import network.FileConnection;

import java.io.IOException;
import java.net.ServerSocket;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;

public class Server {
    public static void main(String[] args) {
        Configuration.loadConfiguration();
        FileConnection.loadFile();
        try {
            Authentication.loadAuthData();
        } catch (IOException e) {
            e.printStackTrace();
        }

        try (ServerSkeleton serverSkeleton = new ServerSkeleton(
                new ServerSocket(Configuration.getPort()),
                new RoomsPool(new HashMap()),
                new LinkedList<>(),
                new LinkedList<>())){
            serverSkeleton.listenSocket();

        } catch (InterruptedException | IOException e) {
            System.err.println("Listen socket failed");
        } catch (Exception e) {
            System.err.println("Listen socket failed");
        }
    }
}
